package com.fish.account.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.fish.account.po.Recharges;
import com.fish.common.constant.QueryPage;
import com.fish.common.dao.BaseIbatisDao;


public class RechargesDAO extends BaseIbatisDao {
	private static final Log loger = LogFactory.getLog(RechargesDAO.class);
	public RechargesDAO() {
		super();
	}

	/**
	 * 根据主键查询
	 * 
	 * @update zhangzhenhua 2010-9-20
	 */
	public Recharges queryRechargesByPrimaryKey(Recharges recharges) {
		loger.debug("selectByPrimaryKey id is :" + recharges.getId());
		return (Recharges) this.getSqlMapClientTemplate().queryForObject("RECHARGES.selectByPrimaryKey", recharges);
	}

	/**
	 * 添加
	 * 
	 * @update zhangzhenhua 2010-9-20
	 */
	public void insertRecharges(Recharges recharges) {
		this.getSqlMapClientTemplate().insert("RECHARGES.insert", recharges);
	}
	
	/**
	 * 修改
	 * 
	 * @update zhangzhenhua 2010-9-20
	 */
	public void updateRecharges(Recharges recharges) {
		this.getSqlMapClientTemplate().update("RECHARGES.updateByPrimaryKeySelective", recharges);
	}
	
	public Long queryRechargesCountByObject(Recharges recharges){
		return  (Long) this.getSqlMapClientTemplate().queryForObject("RECHARGES.countRechargesWithPaging", recharges);
	}
	
	public  List<Recharges> queryRechargesObject(Recharges recharges,QueryPage queryPage){
		recharges.setBeginItem(queryPage.getBeginItem());
		recharges.setEndItem(queryPage.getPageSize());
		return (List<Recharges>) this.getSqlMapClientTemplate().queryForList("RECHARGES.selectRechargesWithPaging", recharges);
	}
}